#ifndef CALCULATOR_H
#define CALCULATOR_H
#include <QDialog>

#include "ui_calculator.h"

#include "calculatornumber.h"
#include <string>
using namespace std;



/*Known bugs*/

/*If the last button they pressed was = when they press a number button, the 
display should be cleared first.*/
/*Issue with repeating 9s*/


enum CalculatorOperation
{
  OPERATION_ADD, 
  OPERATION_SUBTRACT, 
  OPERATION_MULTIPLY, 
  OPERATION_DIVIDE,
  OPERATION_NOTHING
  
};


class Calculator : public QDialog, public Ui::Calculator
{
    Q_OBJECT
  public:
    Calculator(QWidget *parent=0);
  private slots:
    void clicked0();
    void clicked1();
    void clicked2();
    void clicked3();
    void clicked4();
    void clicked5();
    void clicked6();
    void clicked7();
    void clicked8();
    void clicked9();
    
    void clickedPeriod();
    void clickedNegate();
    
    void clickedAdd();
    void clickedSubtract();
    void clickedMultiply();
    void clickedDivide();
    void clickedEqual();
    void clickedMemStore();
    void clickedMemClear();
    void clickedMemRecall();

    void clickedClear();
    void clickedBackspace();
    
    void calculateGpa();
    
    //void clearGpa();
    
    
  private:
/*Calculates the result between number1_ and number2_ and stores in result_.*/
    void calculateResult();
    void eraseLeadingZeroes();
    bool contains(char x=char(0));
    int numOfDigits();
    
    CalculatorNumber number1_, number2_, result_;
    CalculatorOperation operation_;
    
    QString memory_;

/*Needed to fix an issue with QLineEdits...*/
    bool setPeriod_;

    Ui::Calculator *calc;

};









#endif
